﻿using System;
using System.Web.Mvc;

using BlueSky.Web;
using BlueSky.Web.Extentions;

namespace ExampleWebSite.Requests
{
    public class CalcRequestBinder : ModelBinderBase<CalcRequest>
    {
        public override CalcRequest BindTypedModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {            
            int a = GetHttpRequestParam<Int32>(controllerContext, "a", 0);
            int b = GetHttpRequestParam<Int32>(controllerContext, "b", 0);
            return new CalcRequest(a, b);
        }
    }
}
